<template>
	<view class="charging-status">
		<view class="circle-progress" :style="{
			background: `conic-gradient(from 70deg, ${statusProgressColor} ${progress}%, ${progressColor} 0)`,
			color: statusProgressColor,
			width: progressWidth + 'rpx',
			height: progressWidth + 'rpx'
		}">
			<view class="progress-inner" :style="{
				width: (progressWidth - 20) + 'rpx',
				height: (progressWidth - 20) + 'rpx'
			}">
				<text class="progress-value">
					⚡️
				</text>
				<!-- <text class="progress-value">{{progress}}%</text> -->
			</view>
		</view>
		<view class="circle-progress-status" :style="{
			color: statusProgressColor, 
			textAlign: 'center', 
			marginTop: '10rpx', 
		}">{{status}}</view>
	</view>
</template>

<script>
	export default {
		name: 'circle-progress',
		props: {
			progress: {
				type: Number,
				default: 0
			},
			status: {
				type: String,
				default: ''
			},
			statusProgressColor: {
				type: String,
				default: '#42E0A2'
			},
			progressColor: {
				type: String,
				default: '#E6FFF5'
			},
			progressWidth: {
				type: Number,
				default: 128
			}
		}
	}
</script>

<style lang="scss" scoped>
	.charging-status {
		font-family: "PINGFANG";
		width: 150rpx;
		margin-right: 20rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;

		.circle-progress-status {
			font-size: 24rpx;
		}

		.circle-progress {
			width: 128rpx;
			height: 128rpx;
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			position: relative;
			transform: rotate(-90deg);

			.progress-inner {
				width: 108rpx;
				height: 108rpx;
				background: #fff;
				border-radius: 50%;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				transform: rotate(90deg);

				.progress-value {
					font-size: 24rpx;
					font-weight: 500;
					//line-height: 1;
					//margin-bottom: 4rpx;
				}
			}
		}
	}
</style>